/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tygzs.minerpg.CommandExecutor.MineTeam;

import net.md_5.bungee.api.ChatColor;
import net.tygzs.minerpg.Main;
import org.bukkit.command.CommandSender;

/**
测试发送注解
 */
public class Executor
{

    public static void sendHelp(CommandSender sender)
    {
        sender.sendMessage(ChatColor.YELLOW + "/MineTeam 查询相关的指令帮助");
        sender.sendMessage(ChatColor.YELLOW + "/MineTeam Info 查询当前的个人信息");
        sender.sendMessage(ChatColor.YELLOW + "/MineTeam join [队伍名称] 加入指定的队伍");
        sender.sendMessage(ChatColor.YELLOW + "/MineTeam leave 离开队伍");
        sender.sendMessage(ChatColor.YELLOW + "/MineTeam Create [队伍名字] 创建一个队伍");
    }
    public static void leave(CommandSender sender)
    {
    	Main.getTeamConfig().exit(sender.getName());
    }
    public static void create(CommandSender sender,String name)
    {
    	
    }
    public static void sendInfo(CommandSender sender)
    {
        if (Main.getTeamConfig().getBelong(sender.getName()) == null)
        {
            sender.sendMessage(ChatColor.RED + "你还没有加入任何队伍呢!");
        }
        sender.sendMessage(ChatColor.GREEN + "你属于的队伍是:" + Main.getTeamConfig().getBelong(sender.getName()));
    }

    public static void join(CommandSender sender, String name)
    {
        if (Main.getTeamConfig().getBelong(sender.getName()) != null)
        {
            sender.sendMessage(ChatColor.RED + "你已经加入一个队伍了");
            return;
        }
        if (Main.getTeamConfig().Join(sender.getName(), name))
        {
            sender.sendMessage(ChatColor.GREEN + "加入成功!");
        } else
        {
            sender.sendMessage(ChatColor.RED + "队伍不存在!");
        }
    }
}